/*
 * Author yaogaolin refer to https://github.com/yaogao000/
 */
define(['module'], function(module) {
    var config = module.config();
    var mode = config.mode;
    var activity = config.activity;
    var customerThird = config.customerThird;
    var mapping = {
        'defaults': {}
    };
    var current = mapping[mode] || mapping['defaults'];
    return {
        activity: function(name, params) {
            var url = current[name] ? activity + current[name] : activity + name;
            if (!params) return url;
            for (var i = 0; i < params.length; i++) {
                var origin = '{' + i + '}';
                url = url.replace(origin, params[i]);
            }
            return url;
        },
        customerThird: function(name, params) {
            var url = current[name] ? customerThird + current[name] : customerThird + name;
            if (!params) return url;
            for (var i = 0; i < params.length; i++) {
                var origin = '{' + i + '}';
                url = url.replace(origin, params[i]);
            }
            return url;
        }

    };
});
